package com.fanrenqiji.entity;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.Date;

@Getter
@Setter
@Entity
@Table(name="tb_event_detail")
@org.hibernate.annotations.Table(appliesTo = "tb_event_detail",comment = "课程事件明细表")
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate
@org.hibernate.annotations.Cache(region="event_detail", usage = CacheConcurrencyStrategy.READ_WRITE)
public class EventDetailEntity extends DataEntity{

    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long id;

    @ManyToOne
    @JoinColumn(name="event_id",columnDefinition=("bigint(20) default null comment '事件ID'"))//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
    @Where(clause="del_flag="+DEL_FLAG_NORMAL)
    private EventEntity event;

    @ManyToOne
    @JoinColumn(name="semester_id",columnDefinition=("bigint(20) default null comment '学期ID'"))//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
    @Where(clause="del_flag="+DEL_FLAG_NORMAL)
    private SemesterEntity semester;

    @Column(name="status",columnDefinition = ("int(1) not null comment '状态 1:开始，2:暂停，3:结束'"))
    private int status;

    @Column(name="start_time",columnDefinition="datetime default null comment '开始时间'")
    private Date startTime;
    @Column(name="end_time",columnDefinition="datetime default null comment '结束时间'")
    private Date endTime;
}
